#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: grossd
# REQUIRE: NETWORKING
#
# Add the following lines to /etc/rc.conf to enable grossd:
# grossd_enable (bool):		Set it to "YES" to enable grossd.
#                               Default is "NO".
# grossd_flags (str):		Flags passed to grossd on startup.
#                               Default is "".

. %%RC_SUBR%%

name="grossd"
rcvar=${name}_enable

command=%%PREFIX%%/sbin/${name}

load_rc_config $name

: ${grossd_enable="NO"}
: ${grossd_statedir="/var/db/gross"}
: ${grossd_args=""}

grossd_user="nobody"

start_precmd="${name}_prestart"

grossd_prestart()
{
	if [ ! -d "${grossd_statedir}" ]; then
		mkdir -p "${grossd_statedir}"
		chown nobody "${grossd_statedir}"
		${command} -C
	fi
}

run_rc_command "$1"
